/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.ex;

import java.util.Calendar;
import java.util.Scanner;

/**
 * <p>Project: javase202202 - Demo  
 * <p>Powered by Lisi On 2022-06-01 14:08:48
 * <p>Created by IntelliJ IDEA
 *

 * @version 1.0
 * @since 17
 */
public class Demo {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int year = 2022;
        int mouth = 2;
        System.out.println("请输入所要年份");

        year = sc.nextInt();
        System.out.println("请输入所要月份");
        mouth = sc.nextInt();
        var c = Calendar.getInstance();
        int days = 0;
        switch (mouth) {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                days = 31;
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                days = 30;
                break;
            case 2:
                days = year % 400 == 0 || year % 4 == 0 && year % 100 != 0 ? 29 : 28;
                break;
            default:
                days = 0;
                break;
        }


        System.out.printf("%d年%d月有%d天", year, mouth, days);
    }
}
